/*    */ package com.zimbra.cs.redolog.op;
/*    */ 
/*    */ import com.zimbra.common.calendar.ICalTimeZone;
/*    */ import com.zimbra.common.calendar.TimeZoneMap;
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.mailbox.Mailbox;
/*    */ import com.zimbra.cs.mailbox.MailboxManager;
/*    */ import com.zimbra.cs.mailbox.MailboxOperation;
/*    */ import com.zimbra.cs.mailbox.Metadata;
/*    */ import com.zimbra.cs.mailbox.calendar.Invite;
/*    */ import com.zimbra.cs.mailbox.calendar.Util;
/*    */ import com.zimbra.cs.redolog.RedoLogInput;
/*    */ import com.zimbra.cs.redolog.RedoLogOutput;
/*    */ import java.io.IOException;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class ICalReply
/*    */   extends RedoableOp
/*    */ {
/*    */   private Invite mInvite;
/*    */   private String mSender;
/*    */   
/*    */   public ICalReply()
/*    */   {
/* 38 */     super(MailboxOperation.ICalReply);
/*    */   }
/*    */   
/*    */   public ICalReply(int mailboxId, Invite inv, String sender) {
/* 42 */     this();
/* 43 */     setMailboxId(mailboxId);
/* 44 */     this.mInvite = inv;
/* 45 */     this.mSender = sender;
/*    */   }
/*    */   
/*    */   protected String getPrintableData() {
/* 49 */     StringBuilder sb = new StringBuilder();
/* 50 */     ICalTimeZone localTz = this.mInvite.getTimeZoneMap().getLocalTimeZone();
/* 51 */     sb.append("localTZ=").append(Util.encodeAsMetadata(localTz).toString());
/* 52 */     sb.append(", inv=").append(Invite.encodeMetadata(this.mInvite).toString());
/* 53 */     sb.append(", sender=").append(this.mSender);
/* 54 */     return sb.toString();
/*    */   }
/*    */   
/*    */   protected void serializeData(RedoLogOutput out) throws IOException {
/* 58 */     ICalTimeZone localTz = this.mInvite.getTimeZoneMap().getLocalTimeZone();
/* 59 */     out.writeUTF(Util.encodeAsMetadata(localTz).toString());
/* 60 */     out.writeUTF(Invite.encodeMetadata(this.mInvite).toString());
/* 61 */     out.writeUTF(this.mSender);
/*    */   }
/*    */   
/*    */   protected void deserializeData(RedoLogInput in) throws IOException {
/*    */     try {
/* 66 */       ICalTimeZone localTz = Util.decodeTimeZoneFromMetadata(new Metadata(in.readUTF()));
/* 67 */       this.mInvite = Invite.decodeMetadata(getMailboxId(), new Metadata(in.readUTF()), null, localTz);
/* 68 */       this.mSender = in.readUTF();
/*    */     } catch (ServiceException ex) {
/* 70 */       ex.printStackTrace();
/* 71 */       throw new IOException("Cannot read serialized entry for ICalReply " + ex.toString());
/*    */     }
/*    */   }
/*    */   
/*    */   public void redo() throws Exception {
/* 76 */     Mailbox mbox = MailboxManager.getInstance().getMailboxById(getMailboxId());
/* 77 */     mbox.processICalReply(getOperationContext(), this.mInvite, this.mSender);
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/redolog/op/ICalReply.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */